import './public-path'
import { createApp, h } from "vue";
import AppComponent from "./App.vue";
import "./registerServiceWorker";
import iCreateRouter from "./router";
import { createPinia } from 'pinia'
import type { App } from 'vue'

let instance: App | null

declare global {
  interface Window {
    __WUJIE_UNMOUNT: Function
    __WUJIE_MOUNT: Function
    __POWERED_BY_WUJIE__?: boolean;
    __POWERED_BY_QIANKUN__?: boolean;
    __SUB_APP_CACHE__?: App
  }
}
function render() {
  instance = createApp(AppComponent)
  instance.use(createPinia()).use(iCreateRouter())
  instance.mount('#material-app')
}
// change
if(!window.__POWERED_BY_WUJIE__) {
  render()
} else {
  window.__WUJIE_MOUNT = ()=>{
    render()
  }
  window.__WUJIE_UNMOUNT = ()=> {
    instance?.unmount()
  }
}


